//
//  YZPigGroupDeathDetailRecordVideoCell.m
//  VET
//
//  Created by YZ on 2018/7/25.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "YZPigGroupDeathDetailRecordVideoCell.h"
#import <SDWebImage/UIImageView+WebCache.h>


@interface YZPigGroupDeathDetailRecordVideoCell()


@property (nonatomic, strong) UIImageView *pauseImgView;

@end

@implementation YZPigGroupDeathDetailRecordVideoCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if(self = [super initWithFrame:frame]){
        self.layer.masksToBounds = YES;
        [self.contentView addSubview:self.imgView];
        [self.contentView addSubview:self.pauseImgView];
        
        [self makeContraints];
    }
    return self;
}

- (void)makeContraints
{
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self).insets(UIEdgeInsetsZero);
    }];
    
    [self.pauseImgView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(kCurrentDeviceNum(30), kCurrentDeviceNum(30)));
    }];
}

#pragma mark -- setters && getters

- (UIImageView *)imgView
{
    if(!_imgView){
        _imgView = [UIImageView new];
    }
    return _imgView;
}

- (UIImageView *)pauseImgView
{
    if(!_pauseImgView){
        _pauseImgView = [UIImageView new];
        _pauseImgView.image = [UIImage imageNamed:@"ico_video_32"];
    }
    return _pauseImgView;
}

- (void)setModel:(YZPigGroupDeathDetailRecordAttachmentModel *)model
{
    _model = model;
    [self.imgView  sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?x-oss-process=video/snapshot,t_1000,w_400,h_0,m_fast,f_jpg",model.attachmentUrl]]];
}



@end
